
#include "IMetaTypes.h"
#include "member_BClass.h"

using namespace BWE;

//bool functions.
bool bool_create(int argc, BVariant* argv)
{
	argv[0] = false;
	return true;
}
bool bool_create_bool(int argc, BVariant* argv)
{
	bool b = argv[1];
	argv[0] = b;
	return true;
}
bool bool_create_int(int argc, BVariant* argv)
{
	int i = argv[1];
	argv[0] = (bool)i;
	return true;
}
bool bool_create_float(int argc, BVariant* argv)
{
	float f = argv[1];
	argv[0] = (bool)f;
	return true;
}
bool bool_create_double(int argc, BVariant* argv)
{
	double d = argv[1];
	argv[0] = (bool)d;
	return true;
}
bool bool_release(int argc, BVariant* argv)
{
	return true;
}

bool bool_assign_bool(int argc, BVariant* argv)
{
	bool b = argv[1];
	argv[0] = b;
	return true;
}
bool bool_assign_int(int argc, BVariant* argv)
{
	int i = argv[1];
	argv[0] = (bool)i;
	return true;
}
bool bool_assign_float(int argc, BVariant* argv)
{
	float f = argv[1];
	argv[0] = (bool)f;
	return true;
}
bool bool_assign_double(int argc, BVariant* argv)
{
	double d = argv[1];
	argv[0] = (bool)d;
	return true;
}

bool bool_equal_bool(int argc, BVariant* argv)
{
	bool v = argv[0];
	bool b1 = argv[1];
	argv[0].setValue(v == b1);
	return true;
}
bool bool_equal_int(int argc, BVariant* argv)
{
	bool v = argv[0];
	int i = argv[1];
	argv[0].setValue(v == (bool)i);
	return true;
}
bool bool_equal_long(int argc, BVariant* argv)
{
	bool v = argv[0];
	long long l = argv[1];
	argv[0].setValue(v == (bool)l);
	return true;
}
bool bool_equal_float(int argc, BVariant* argv)
{
	bool v = argv[0];
	float f = argv[1];
	argv[0].setValue(v == (bool)f);
	return true;
}
bool bool_equal_double(int argc, BVariant* argv)
{
	bool v = argv[0];
	double d = argv[1];
	argv[0].setValue(v == (bool)d);
	return true;
}

bool bool_unequal_bool(int argc, BVariant* argv)
{
	bool v = argv[0];
	bool b1 = argv[1];
	argv[0].setValue(v != b1);
	return true;
}
bool bool_unequal_int(int argc, BVariant* argv)
{
	bool v = argv[0];
	int i = argv[1];
	argv[0].setValue(v != (bool)i);
	return true;
}
bool bool_unequal_long(int argc, BVariant* argv)
{
	bool v = argv[0];
	long long l = argv[1];
	argv[0].setValue(v != (bool)l);
	return true;
}
bool bool_unequal_float(int argc, BVariant* argv)
{
	bool v = argv[0];
	float f = argv[1];
	argv[0].setValue(v != (bool)f);
	return true;
}
bool bool_unequal_double(int argc, BVariant* argv)
{
	bool v = argv[0];
	double d = argv[1];
	argv[0].setValue(v != (bool)d);
	return true;
}

BClass* BWE::CreateBoolClass()
{
	BClass* cls = new BClass();
	cls->insertMethod("bool()", bool_create);
	cls->insertMethod("bool(bool)", bool_create_bool);
	cls->insertMethod("bool(int)", bool_create_int);
	cls->insertMethod("bool =(int)", bool_assign_int);
	cls->insertMethod("bool =(float)", bool_assign_float);
	cls->insertMethod("bool =(double)", bool_assign_double);

	cls->insertMethod("bool ==(bool)", bool_equal_bool);
	cls->insertMethod("bool ==(int)", bool_equal_int);
	cls->insertMethod("bool ==(long)", bool_equal_long);
	cls->insertMethod("bool ==(float)", bool_equal_float);
	cls->insertMethod("bool ==(double)", bool_equal_double);

	cls->insertMethod("bool !=(bool)", bool_unequal_bool);
	cls->insertMethod("bool !=(int)", bool_unequal_int);
	cls->insertMethod("bool !=(long)", bool_unequal_long);
	cls->insertMethod("bool !=(float)", bool_unequal_float);
	cls->insertMethod("bool !=(double)", bool_unequal_double);
	return cls;
}

//int functions.
bool int_create(int argc, BVariant* argv)
{
	argv[0] = 0;
	return true;
}
bool int_create_int(int argc, BVariant* argv)
{
	int i = argv[1];
	argv[0] = i;
	return true;
}
bool int_release(int argc, BVariant* argv)
{
	return true;
}

bool int_plus_plus(int argc, BVariant* argv)
{
	int& v = argv[0];
	v++;
	return true;
}
bool int_minus_minus(int argc, BVariant* argv)
{
	int& v = argv[0];
	v--;
	return true;
}

bool int_plus_int(int argc, BVariant* argv)
{
	int v = argv[0];
	int a = argv[1];
	argv[0].setValue(v + a);
	return true;
}
bool int_plus_long(int argc, BVariant* argv)
{
	int v = argv[0];
	long long b = argv[1];
	argv[0].setValue(v + b);
	return true;
}
bool int_plus_float(int argc, BVariant* argv)
{
	int v = argv[0];
	float f = argv[1];
	argv[0].setValue(v + f);
	return true;
}
bool int_plus_double(int argc, BVariant* argv)
{
	int v = argv[0];
	double d = argv[1];
	argv[0].setValue(v + d);
	return true;
}

bool int_plus_assign_int(int argc, BVariant* argv)
{
	int& v = argv[0];
	int i = argv[1];
	v = v + i;
	return true;
}
bool int_plus_assign_long(int argc, BVariant* argv)
{
	int& v = argv[0];
	long long l = argv[1];
	v = (int)(v + l);
	return true;
}
bool int_plus_assign_float(int argc, BVariant* argv)
{
	int& v = argv[0];
	float f = argv[1];
	v = (int)(v + f);
	return true;
}
bool int_plus_assign_double(int argc, BVariant* argv)
{
	int& v = argv[0];
	double d = argv[1];
	v = (int)(v + d);
	return true;
}

bool int_minus_int(int argc, BVariant* argv)
{
	int v = argv[0];
	double d = argv[1];
	argv[0].setValue(v - d);
	return true;
}
bool int_minus_long(int argc, BVariant* argv)
{
	int v = argv[0];
	double d = argv[1];
	argv[0].setValue(v - d);
	return true;
}
bool int_minus_float(int argc, BVariant* argv)
{
	int v = argv[0];
	double d = argv[1];
	argv[0].setValue(v - d);
	return true;
}
bool int_minus_double(int argc, BVariant* argv)
{
	int v = argv[0];
	double d = argv[1];
	argv[0].setValue(v - d);
	return true;
}

bool int_minus_assign_int(int argc, BVariant* argv)
{
	int& v = argv[0];
	int i = argv[1];
	v -= i;
	return true;
}
bool int_minus_assign_long(int argc, BVariant* argv)
{
	int& v = argv[0];
	long long l = argv[1];
	v = (int)(v - l);
	return true;
}
bool int_minus_assign_float(int argc, BVariant* argv)
{
	int& v = argv[0];
	float f = argv[1];
	v = (int)(v - f);
	return true;
}
bool int_minus_assign_double(int argc, BVariant* argv)
{
	int& v = argv[0];
	double d = argv[1];
	v = (int)(v - d);
	return true;
}

bool int_equal_bool(int argc, BVariant* argv)
{
	int v = argv[0];
	bool b = argv[1];
	argv[0].setValue((bool)v == b);
	return true;
}
bool int_equal_int(int argc, BVariant* argv)
{
	int v = argv[0];
	int i = argv[1];
	argv[0].setValue(v == i);
	return true;
}
bool int_equal_long(int argc, BVariant* argv)
{
	int v = argv[0];
	long l = argv[1];
	argv[0].setValue(v == l);
	return true;
}
bool int_equal_float(int argc, BVariant* argv)
{
	int v = argv[0];
	float f = argv[1];
	argv[0].setValue(v == f);
	return true;
}
bool int_equal_double(int argc, BVariant* argv)
{
	int v = argv[0];
	double d = argv[1];
	argv[0].setValue(v == d);
	return true;
}

bool int_unequal_bool(int argc, BVariant* argv)
{
	int v = argv[0];
	bool b = argv[1];
	argv[0].setValue((bool)v != b);
	return true;
}
bool int_unequal_int(int argc, BVariant* argv)
{
	int v = argv[0];
	int i = argv[1];
	argv[0].setValue(v == i);
	return true;
}
bool int_unequal_long(int argc, BVariant* argv)
{
	int v = argv[0];
	long l = argv[1];
	argv[0].setValue(v != l);
	return true;
}
bool int_unequal_float(int argc, BVariant* argv)
{
	int v = argv[0];
	float f = argv[1];
	argv[0].setValue(v != f);
	return true;
}
bool int_unequal_double(int argc, BVariant* argv)
{
	int v = argv[0];
	double d = argv[1];
	argv[0].setValue(v != d);
	return true;
}

bool int_greater_int(int argc, BVariant* argv)
{
	int v = argv[0];
	int i1 = argv[1];
	argv[0].setValue(v > i1);
	return true;
}
bool int_greater_long(int argc, BVariant* argv)
{
	int v = argv[0];
	long long l = argv[1];
	argv[0].setValue(v > l);
	return true;
}
bool int_greater_float(int argc, BVariant* argv)
{
	int v = argv[0];
	float f = argv[1];
	argv[0].setValue(v > f);
	return true;
}
bool int_greater_double(int argc, BVariant* argv)
{
	int v = argv[0];
	double d = argv[1];
	argv[0].setValue(v > d);
	return true;
}

bool int_less_int(int argc, BVariant* argv)
{
	int v = argv[0];
	int i1 = argv[1];
	argv[0].setValue(v < i1);
	return true;
}
bool int_less_long(int argc, BVariant* argv)
{
	int v = argv[0];
	long long l = argv[1];
	argv[0].setValue(v < l);
	return true;
}
bool int_less_float(int argc, BVariant* argv)
{
	int v = argv[0];
	float f = argv[1];
	argv[0].setValue(v < f);
	return true;
}
bool int_less_double(int argc, BVariant* argv)
{
	int v = argv[0];
	double d = argv[1];
	argv[0].setValue(v < d);
	return true;
}

bool int_greater_equal_int(int argc, BVariant* argv)
{
	int v = argv[0];
	int i1 = argv[1];
	argv[0].setValue(v >= i1);
	return true;
}
bool int_greater_equal_long(int argc, BVariant* argv)
{
	int v = argv[0];
	long long l = argv[1];
	argv[0].setValue(v >= l);
	return true;
}
bool int_greater_equal_float(int argc, BVariant* argv)
{
	int v = argv[0];
	float f = argv[1];
	argv[0].setValue(v >= f);
	return true;
}
bool int_greater_equal_double(int argc, BVariant* argv)
{
	int v = argv[0];
	double d = argv[1];
	argv[0].setValue(v >= d);
	return true;
}

bool int_less_equal_int(int argc, BVariant* argv)
{
	int v = argv[0];
	int i1 = argv[1];
	argv[0].setValue(v <= i1);
	return true;
}
bool int_less_equal_long(int argc, BVariant* argv)
{
	int v = argv[0];
	long long l = argv[1];
	argv[0].setValue(v <= l);
	return true;
}
bool int_less_equal_float(int argc, BVariant* argv)
{
	int v = argv[0];
	float f = argv[1];
	argv[0].setValue(v <= f);
	return true;
}
bool int_less_equal_double(int argc, BVariant* argv)
{
	int v = argv[0];
	double d = argv[1];
	argv[0].setValue(v <= d);
	return true;
}

BClass* BWE::CreateIntClass()
{
	BClass* cls = new BClass();

	cls->insertMethod("int()", int_create);
	cls->insertMethod("int(int)", int_create_int);
	cls->insertMethod("~int()", int_release);

	cls->insertMethod("++()", int_plus_plus);
	cls->insertMethod("--()", int_minus_minus);

	cls->insertMethod("int +(int)", int_plus_int);
	cls->insertMethod("long +(long)", int_plus_long);
	cls->insertMethod("float +(float)", int_plus_float);
	cls->insertMethod("double +(double)", int_plus_double);

	cls->insertMethod("+=(int)", int_plus_assign_int);
	cls->insertMethod("+=(long)", int_plus_assign_long);
	cls->insertMethod("+=(float)", int_plus_assign_float);
	cls->insertMethod("+=(double)", int_plus_assign_double);

	cls->insertMethod("int -(int)", int_minus_int);
	cls->insertMethod("long -(long)", int_minus_long);
	cls->insertMethod("float -(float)", int_minus_float);
	cls->insertMethod("double -(double)", int_minus_double);

	cls->insertMethod("-=(int)", int_minus_assign_int);
	cls->insertMethod("-=(long)", int_minus_assign_long);
	cls->insertMethod("-=(float)", int_minus_assign_float);
	cls->insertMethod("-=(double)", int_minus_assign_double);

	cls->insertMethod("bool ==(bool)", int_equal_bool);
	cls->insertMethod("bool ==(int)", int_equal_int);
	cls->insertMethod("bool ==(long)", int_equal_long);
	cls->insertMethod("bool ==(float)", int_equal_float);
	cls->insertMethod("bool ==(double)", int_equal_double);

	cls->insertMethod("bool !=(bool)", int_unequal_bool);
	cls->insertMethod("bool !=(int)", int_unequal_int);
	cls->insertMethod("bool !=(long)", int_unequal_long);
	cls->insertMethod("bool !=(float)", int_unequal_float);
	cls->insertMethod("bool !=(double)", int_unequal_double);

	cls->insertMethod("bool >(int)", int_greater_int);
	cls->insertMethod("bool >(long)", int_greater_long);
	cls->insertMethod("bool >(float)", int_greater_float);
	cls->insertMethod("bool >(double)", int_greater_double);

	cls->insertMethod("bool <(int)", int_less_int);
	cls->insertMethod("bool <(long)", int_less_long);
	cls->insertMethod("bool <(float)", int_less_float);
	cls->insertMethod("bool <(double)", int_less_double);

	cls->insertMethod("bool >=(int)", int_greater_equal_int);
	cls->insertMethod("bool >=(long)", int_greater_equal_long);
	cls->insertMethod("bool >=(float)", int_greater_equal_float);
	cls->insertMethod("bool >=(double)", int_greater_equal_double);

	cls->insertMethod("bool <=(int)", int_less_equal_int);
	cls->insertMethod("bool <=(long)", int_less_equal_long);
	cls->insertMethod("bool <=(float)", int_less_equal_float);
	cls->insertMethod("bool <=(double)", int_less_equal_double);

	return cls;
}

//long functions.
bool long_create(int argc, BVariant* argv)
{
	argv[0] = (long long)0;
	return true;
}
bool long_create_int(int argc, BVariant* argv)
{
	int i = argv[1];
	argv[0] = (long long)i;
	return true;
}
bool long_release(int argc, BVariant* argv)
{
	return true;
}

bool long_plus_plus(int argc, BVariant* argv)
{
	long long& v = argv[0];
	v++;
	return true;
}
bool long_minus_minus(int argc, BVariant* argv)
{
	long long& v = argv[0];
	v--;
	return true;
}

bool long_plus_int(int argc, BVariant* argv)
{
	long long v = argv[0];
	int a = argv[1];
	argv[0].setValue(v + a);
	return true;
}
bool long_plus_long(int argc, BVariant* argv)
{
	long long v = argv[0];
	long long b = argv[1];
	argv[0].setValue(v + b);
	return true;
}
bool long_plus_float(int argc, BVariant* argv)
{
	long long v = argv[0];
	float f = argv[1];
	argv[0].setValue(v + f);
	return true;
}
bool long_plus_double(int argc, BVariant* argv)
{
	long long v = argv[0];
	double d = argv[1];
	argv[0].setValue(v + d);
	return true;
}

bool long_plus_assign_int(int argc, BVariant* argv)
{
	long long& v = argv[0];
	int i = argv[1];
	v += i;
	return true;
}
bool long_plus_assign_long(int argc, BVariant* argv)
{
	long long& v = argv[0];
	long long l = argv[1];
	v += l;
	return true;
}
bool long_plus_assign_float(int argc, BVariant* argv)
{
	long long& v = argv[0];
	float f = argv[1];
	v = (long long)(v + f);
	return true;
}
bool long_plus_assign_double(int argc, BVariant* argv)
{
	long long& v = argv[0];
	double d = argv[1];
	v = (long long)(v + d);
	return true;
}

bool long_minus_int(int argc, BVariant* argv)
{
	long long v = argv[0];
	double d = argv[1];
	argv[0].setValue(v - d);
	return true;
}
bool long_minus_long(int argc, BVariant* argv)
{
	long long v = argv[0];
	double d = argv[1];
	argv[0].setValue(v - d);
	return true;
}
bool long_minus_float(int argc, BVariant* argv)
{
	long long v = argv[0];
	double d = argv[1];
	argv[0].setValue(v - d);
	return true;
}
bool long_minus_double(int argc, BVariant* argv)
{
	long long v = argv[0];
	double d = argv[1];
	argv[0].setValue(v - d);
	return true;
}

bool long_minus_assign_int(int argc, BVariant* argv)
{
	long long& v = argv[0];
	int i = argv[1];
	v -= i;
	return true;
}
bool long_minus_assign_long(int argc, BVariant* argv)
{
	long long& v = argv[0];
	long long l = argv[1];
	v -= l;
	return true;
}
bool long_minus_assign_float(int argc, BVariant* argv)
{
	long long& v = argv[0];
	float f = argv[1];
	v = (long long)(v - f);
	return true;
}
bool long_minus_assign_double(int argc, BVariant* argv)
{
	long long& v = argv[0];
	double d = argv[1];
	v = (long long)(v - d);
	return true;
}

bool long_equal_bool(int argc, BVariant* argv)
{
	long long v = argv[0];
	bool b = argv[1];
	argv[0].setValue((bool)v == b);
	return true;
}
bool long_equal_int(int argc, BVariant* argv)
{
	long long v = argv[0];
	int i = argv[1];
	argv[0].setValue(v == i);
	return true;
}
bool long_equal_long(int argc, BVariant* argv)
{
	long long v = argv[0];
	long l = argv[1];
	argv[0].setValue(v == l);
	return true;
}
bool long_equal_float(int argc, BVariant* argv)
{
	long long v = argv[0];
	float f = argv[1];
	argv[0].setValue(v == f);
	return true;
}
bool long_equal_double(int argc, BVariant* argv)
{
	long long v = argv[0];
	double d = argv[1];
	argv[0].setValue(v == d);
	return true;
}

bool long_unequal_bool(int argc, BVariant* argv)
{
	long long v = argv[0];
	bool b = argv[1];
	argv[0].setValue((bool)v != b);
	return true;
}
bool long_unequal_int(int argc, BVariant* argv)
{
	long long v = argv[0];
	int i = argv[1];
	argv[0].setValue(v == i);
	return true;
}
bool long_unequal_long(int argc, BVariant* argv)
{
	long long v = argv[0];
	long l = argv[1];
	argv[0].setValue(v != l);
	return true;
}
bool long_unequal_float(int argc, BVariant* argv)
{
	long long v = argv[0];
	float f = argv[1];
	argv[0].setValue(v != f);
	return true;
}
bool long_unequal_double(int argc, BVariant* argv)
{
	long long v = argv[0];
	double d = argv[1];
	argv[0].setValue(v != d);
	return true;
}

bool long_greater_int(int argc, BVariant* argv)
{
	long long v = argv[0];
	int i1 = argv[1];
	argv[0].setValue(v > i1);
	return true;
}
bool long_greater_long(int argc, BVariant* argv)
{
	long long v = argv[0];
	long long l = argv[1];
	argv[0].setValue(v > l);
	return true;
}
bool long_greater_float(int argc, BVariant* argv)
{
	long long v = argv[0];
	float f = argv[1];
	argv[0].setValue(v > f);
	return true;
}
bool long_greater_double(int argc, BVariant* argv)
{
	long long v = argv[0];
	double d = argv[1];
	argv[0].setValue(v > d);
	return true;
}

bool long_less_int(int argc, BVariant* argv)
{
	long long v = argv[0];
	int i1 = argv[1];
	argv[0].setValue(v < i1);
	return true;
}
bool long_less_long(int argc, BVariant* argv)
{
	long long v = argv[0];
	long long l = argv[1];
	argv[0].setValue(v < l);
	return true;
}
bool long_less_float(int argc, BVariant* argv)
{
	long long v = argv[0];
	float f = argv[1];
	argv[0].setValue(v < f);
	return true;
}
bool long_less_double(int argc, BVariant* argv)
{
	long long v = argv[0];
	double d = argv[1];
	argv[0].setValue(v < d);
	return true;
}

bool long_greater_equal_int(int argc, BVariant* argv)
{
	long long v = argv[0];
	int i = argv[1];
	argv[0].setValue(v >= i);
	return true;
}
bool long_greater_equal_long(int argc, BVariant* argv)
{
	long long v = argv[0];
	long long l = argv[1];
	argv[0].setValue(v >= l);
	return true;
}
bool long_greater_equal_float(int argc, BVariant* argv)
{
	long long v = argv[0];
	float f = argv[1];
	argv[0].setValue(v >= f);
	return true;
}
bool long_greater_equal_double(int argc, BVariant* argv)
{
	long long v = argv[0];
	double d = argv[1];
	argv[0].setValue(v >= d);
	return true;
}

bool long_less_equal_int(int argc, BVariant* argv)
{
	long long v = argv[0];
	int i = argv[1];
	argv[0].setValue(v <= i);
	return true;
}
bool long_less_equal_long(int argc, BVariant* argv)
{
	long long v = argv[0];
	long long l = argv[1];
	argv[0].setValue(v <= l);
	return true;
}
bool long_less_equal_float(int argc, BVariant* argv)
{
	long long v = argv[0];
	float f = argv[1];
	argv[0].setValue(v <= f);
	return true;
}
bool long_less_equal_double(int argc, BVariant* argv)
{
	long long v = argv[0];
	double d = argv[1];
	argv[0].setValue(v <= d);
	return true;
}

BClass* BWE::CreateLongClass()
{
	BClass* cls = new BClass();

	cls->insertMethod("long()", long_create);
	cls->insertMethod("long(int)", long_create_int);
	cls->insertMethod("~long()", long_release);

	cls->insertMethod("++()", long_plus_plus);
	cls->insertMethod("--()", long_minus_minus);

	cls->insertMethod("int +(int)", long_plus_int);
	cls->insertMethod("long +(long)", long_plus_long);
	cls->insertMethod("float +(float)", long_plus_float);
	cls->insertMethod("double +(double)", long_plus_double);

	cls->insertMethod("+=(int)", long_plus_assign_int);
	cls->insertMethod("+=(long)", long_plus_assign_long);
	cls->insertMethod("+=(float)", long_plus_assign_float);
	cls->insertMethod("+=(double)", long_plus_assign_double);

	cls->insertMethod("int -(int)", long_minus_int);
	cls->insertMethod("long -(long)", long_minus_long);
	cls->insertMethod("float -(float)", long_minus_float);
	cls->insertMethod("double -(double)", long_minus_double);

	cls->insertMethod("-=(int)", long_minus_assign_int);
	cls->insertMethod("-=(long)", long_minus_assign_long);
	cls->insertMethod("-=(float)", long_minus_assign_float);
	cls->insertMethod("-=(double)", long_minus_assign_double);

	cls->insertMethod("bool ==(bool)", long_equal_bool);
	cls->insertMethod("bool ==(int)", long_equal_int);
	cls->insertMethod("bool ==(long)", long_equal_long);
	cls->insertMethod("bool ==(float)", long_equal_float);
	cls->insertMethod("bool ==(double)", long_equal_double);

	cls->insertMethod("bool !=(bool)", long_unequal_bool);
	cls->insertMethod("bool !=(int)", long_unequal_int);
	cls->insertMethod("bool !=(long)", long_unequal_long);
	cls->insertMethod("bool !=(float)", long_unequal_float);
	cls->insertMethod("bool !=(double)", long_unequal_double);

	cls->insertMethod("bool >(int)", long_greater_int);
	cls->insertMethod("bool >(long)", long_greater_long);
	cls->insertMethod("bool >(float)", long_greater_float);
	cls->insertMethod("bool >(double)", long_greater_double);

	cls->insertMethod("bool <(int)", long_less_int);
	cls->insertMethod("bool <(long)", long_less_long);
	cls->insertMethod("bool <(float)", long_less_float);
	cls->insertMethod("bool <(double)", long_less_double);

	cls->insertMethod("bool >=(int)", long_greater_equal_int);
	cls->insertMethod("bool >=(long)", long_greater_equal_long);
	cls->insertMethod("bool >=(float)", long_greater_equal_float);
	cls->insertMethod("bool >=(double)", long_greater_equal_double);

	cls->insertMethod("bool <=(int)", long_less_equal_int);
	cls->insertMethod("bool <=(long)", long_less_equal_long);
	cls->insertMethod("bool <=(float)", long_less_equal_float);
	cls->insertMethod("bool <=(double)", long_less_equal_double);

	return cls;
}

//float functions.
bool float_create(int argc, BVariant* argv)
{
	argv[0] = 0.0f;
	return true;
}
bool float_create_bool(int argc, BVariant* argv)
{
	bool b = argv[1];
	argv[0] = b ? 1.0f : 0.0f;
	return true;
}
bool float_create_double(int argc, BVariant* argv)
{
	double d = argv[1];
	argv[0] = (float)d;
	return true;
}
bool float_create_float(int argc, BVariant* argv)
{
	argv[0] = argv[1];
	return true;
}
bool float_create_int(int argc, BVariant* argv)
{
	int v = argv[1];
	argv[0] = (float)v;
	return true;
}
bool float_release(int argc, BVariant* argv)
{

	return true;
}

bool float_assign_int(int argc, BVariant* argv)
{
	int i = argv[1];
	argv[0] = (float)i;
	return true;
}
bool float_assign_float(int argc, BVariant* argv)
{
	argv[0] = argv[1];
	return true;
}
bool float_assign_double(int argc, BVariant* argv)
{
	double d = argv[1];
	argv[0] = (float)d;
	return true;
}
bool float_assign_bool(int argc, BVariant* argv)
{
	bool b = argv[1];
	argv[0] = b ? 1.0f : 0.0f;
	return true;
}

bool float_plus_plus(int argc, BVariant* argv)
{
	float& v = argv[0];
	v++;
	return true;
}
bool float_minus_minus(int argc, BVariant* argv)
{
	float& v = argv[0];
	v--;
	return true;
}

bool float_plus_int(int argc, BVariant* argv)
{
	float v = argv[0];
	int a = argv[1];
	argv[0].setValue(v + a);
	return true;
}
bool float_plus_long(int argc, BVariant* argv)
{
	float v = argv[0];
	long long b = argv[1];
	argv[0].setValue(v + b);
	return true;
}
bool float_plus_float(int argc, BVariant* argv)
{
	float v = argv[0];
	float f = argv[1];
	argv[0].setValue(v + f);
	return true;
}
bool float_plus_double(int argc, BVariant* argv)
{
	float v = argv[0];
	double d = argv[1];
	argv[0].setValue(v + d);
	return true;
}

bool float_plus_assign_int(int argc, BVariant* argv)
{
	float& v = argv[0];
	int i = argv[1];
	v += i;
	return true;
}
bool float_plus_assign_long(int argc, BVariant* argv)
{
	float& v = argv[0];
	long long l = argv[1];
	v += l;
	return true;
}
bool float_plus_assign_float(int argc, BVariant* argv)
{
	float& v = argv[0];
	float f = argv[1];
	v += f;
	return true;
}
bool float_plus_assign_double(int argc, BVariant* argv)
{
	float& v = argv[0];
	double d = argv[1];
	v = (float)(v + d);
	return true;
}

bool float_minus_int(int argc, BVariant* argv)
{
	float v = argv[0];
	double d = argv[1];
	argv[0].setValue(v - d);
	return true;
}
bool float_minus_long(int argc, BVariant* argv)
{
	float v = argv[0];
	double d = argv[1];
	argv[0].setValue(v - d);
	return true;
}
bool float_minus_float(int argc, BVariant* argv)
{
	float v = argv[0];
	double d = argv[1];
	argv[0].setValue(v - d);
	return true;
}
bool float_minus_double(int argc, BVariant* argv)
{
	float v = argv[0];
	double d = argv[1];
	argv[0].setValue(v - d);
	return true;
}

bool float_minus_assign_int(int argc, BVariant* argv)
{
	float& v = argv[0];
	int i = argv[1];
	v -= i;
	return true;
}
bool float_minus_assign_long(int argc, BVariant* argv)
{
	float& v = argv[0];
	long long l = argv[1];
	v -= l;
	return true;
}
bool float_minus_assign_float(int argc, BVariant* argv)
{
	float& v = argv[0];
	float f = argv[1];
	v -= f;
	return true;
}
bool float_minus_assign_double(int argc, BVariant* argv)
{
	float& v = argv[0];
	double d = argv[1];
	v = (float)(v - d);
	return true;
}

bool float_equal_bool(int argc, BVariant* argv)
{
	float v = argv[0];
	bool b = argv[1];
	argv[0].setValue((bool)v == b);
	return true;
}
bool float_equal_int(int argc, BVariant* argv)
{
	float v = argv[0];
	int i = argv[1];
	argv[0].setValue(v == i);
	return true;
}
bool float_equal_long(int argc, BVariant* argv)
{
	float v = argv[0];
	long l = argv[1];
	argv[0].setValue(v == l);
	return true;
}
bool float_equal_float(int argc, BVariant* argv)
{
	float v = argv[0];
	float f = argv[1];
	argv[0].setValue(v == f);
	return true;
}
bool float_equal_double(int argc, BVariant* argv)
{
	float v = argv[0];
	double d = argv[1];
	argv[0].setValue(v == d);
	return true;
}

bool float_unequal_bool(int argc, BVariant* argv)
{
	float v = argv[0];
	bool b = argv[1];
	argv[0].setValue((bool)v != b);
	return true;
}
bool float_unequal_int(int argc, BVariant* argv)
{
	float v = argv[0];
	int i = argv[1];
	argv[0].setValue(v == i);
	return true;
}
bool float_unequal_long(int argc, BVariant* argv)
{
	float v = argv[0];
	long l = argv[1];
	argv[0].setValue(v != l);
	return true;
}
bool float_unequal_float(int argc, BVariant* argv)
{
	float v = argv[0];
	float f = argv[1];
	argv[0].setValue(v != f);
	return true;
}
bool float_unequal_double(int argc, BVariant* argv)
{
	float v = argv[0];
	double d = argv[1];
	argv[0].setValue(v != d);
	return true;
}

bool float_greater_int(int argc, BVariant* argv)
{
	float v = argv[0];
	int i = argv[1];
	argv[0].setValue(v > i);
	return true;
}
bool float_greater_long(int argc, BVariant* argv)
{
	float v = argv[0];
	long long l = argv[1];
	argv[0].setValue(v > l);
	return true;
}
bool float_greater_float(int argc, BVariant* argv)
{
	float v = argv[0];
	float f = argv[1];
	argv[0].setValue(v > f);
	return true;
}
bool float_greater_double(int argc, BVariant* argv)
{
	float v = argv[0];
	double d = argv[1];
	argv[0].setValue(v > d);
	return true;
}

bool float_less_int(int argc, BVariant* argv)
{
	float v = argv[0];
	int i = argv[1];
	argv[0].setValue(v < i);
	return true;
}
bool float_less_long(int argc, BVariant* argv)
{
	float v = argv[0];
	long long l = argv[1];
	argv[0].setValue(v < l);
	return true;
}
bool float_less_float(int argc, BVariant* argv)
{
	float v = argv[0];
	float f = argv[1];
	argv[0].setValue(v < f);
	return true;
}
bool float_less_double(int argc, BVariant* argv)
{
	float v = argv[0];
	double d = argv[1];
	argv[0].setValue(v < d);
	return true;
}

bool float_greater_equal_int(int argc, BVariant* argv)
{
	float v = argv[0];
	int i = argv[1];
	argv[0].setValue(v >= i);
	return true;
}
bool float_greater_equal_long(int argc, BVariant* argv)
{
	float v = argv[0];
	long long l = argv[1];
	argv[0].setValue(v >= l);
	return true;
}
bool float_greater_equal_float(int argc, BVariant* argv)
{
	float v = argv[0];
	float f = argv[1];
	argv[0].setValue(v >= f);
	return true;
}
bool float_greater_equal_double(int argc, BVariant* argv)
{
	float v = argv[0];
	double d = argv[1];
	argv[0].setValue(v >= d);
	return true;
}

bool float_less_equal_int(int argc, BVariant* argv)
{
	float v = argv[0];
	int i = argv[1];
	argv[0].setValue(v <= i);
	return true;
}
bool float_less_equal_long(int argc, BVariant* argv)
{
	float v = argv[0];
	long long l = argv[1];
	argv[0].setValue(v <= l);
	return true;
}
bool float_less_equal_float(int argc, BVariant* argv)
{
	float v = argv[0];
	float f = argv[1];
	argv[0].setValue(v <= f);
	return true;
}
bool float_less_equal_double(int argc, BVariant* argv)
{
	float v = argv[0];
	double d = argv[1];
	argv[0].setValue(v <= d);
	return true;
}

BClass* BWE::CreateFloatClass()
{
	BClass* cls = new BClass();

	cls->insertMethod("float()", float_create);
	cls->insertMethod("float(bool)", float_create_bool);
	cls->insertMethod("float(int)", float_create_int);
	cls->insertMethod("float(float)", float_create_float);
	cls->insertMethod("float(double)", float_create_double);

	cls->insertMethod("float =(bool)", float_assign_bool);
	cls->insertMethod("float =(int)", float_assign_int);
	cls->insertMethod("float =(float)", float_assign_float);
	cls->insertMethod("float =(double)", float_assign_double);

	cls->insertMethod("++()", float_plus_plus);
	cls->insertMethod("--()", float_minus_minus);

	cls->insertMethod("float +(int)", float_plus_int);
	cls->insertMethod("float +(long)", float_plus_long);
	cls->insertMethod("float +(float)", float_plus_float);
	cls->insertMethod("double +(double)", float_plus_double);

	cls->insertMethod("+=(int)", float_plus_assign_int);
	cls->insertMethod("+=(long)", float_plus_assign_long);
	cls->insertMethod("+=(float)", float_plus_assign_float);
	cls->insertMethod("+=(double)", float_plus_assign_double);

	cls->insertMethod("float -(int)", float_minus_int);
	cls->insertMethod("float -(long)", float_minus_long);
	cls->insertMethod("float -(float)", float_minus_float);
	cls->insertMethod("double -(double)", float_minus_double);

	cls->insertMethod("-=(int)", float_minus_assign_int);
	cls->insertMethod("-=(long)", float_minus_assign_long);
	cls->insertMethod("-=(float)", float_minus_assign_float);
	cls->insertMethod("-=(double)", float_minus_assign_double);

	cls->insertMethod("bool ==(bool)", float_equal_bool);
	cls->insertMethod("bool ==(int)", float_equal_int);
	cls->insertMethod("bool ==(long)", float_equal_long);
	cls->insertMethod("bool ==(float)", float_equal_float);
	cls->insertMethod("bool ==(double)", float_equal_double);

	cls->insertMethod("bool !=(bool)", float_unequal_bool);
	cls->insertMethod("bool !=(int)", float_unequal_int);
	cls->insertMethod("bool !=(long)", float_unequal_long);
	cls->insertMethod("bool !=(float)", float_unequal_float);
	cls->insertMethod("bool !=(double)", float_unequal_double);

	cls->insertMethod("bool >(int)", float_greater_int);
	cls->insertMethod("bool >(long)", float_greater_long);
	cls->insertMethod("bool >(float)", float_greater_float);
	cls->insertMethod("bool >(double)", float_greater_double);

	cls->insertMethod("bool <(int)", float_less_int);
	cls->insertMethod("bool <(long)", float_less_long);
	cls->insertMethod("bool <(float)", float_less_float);
	cls->insertMethod("bool <(double)", float_less_double);

	cls->insertMethod("bool >=(int)", float_greater_equal_int);
	cls->insertMethod("bool >=(long)", float_greater_equal_long);
	cls->insertMethod("bool >=(float)", float_greater_equal_float);
	cls->insertMethod("bool >=(double)", float_greater_equal_double);

	cls->insertMethod("bool <=(int)", float_less_equal_int);
	cls->insertMethod("bool <=(long)", float_less_equal_long);
	cls->insertMethod("bool <=(float)", float_less_equal_float);
	cls->insertMethod("bool <=(double)", float_less_equal_double);

	return cls;
}

//double functions.
bool double_create(int argc, BVariant* argv)
{
	argv[0] = 0.0;
	return true;
}
bool double_create_bool(int argc, BVariant* argv)
{
	bool b = argv[1];
	argv[0] = b ? 1.0 : 0.0;
	return true;
}
bool double_create_double(int argc, BVariant* argv)
{
	argv[0] = argv[1];
	return true;
}
bool double_create_float(int argc, BVariant* argv)
{
	float f = argv[1];
	argv[0] = (double)f;
	return true;
}
bool double_create_int(int argc, BVariant* argv)
{
	int v = argv[1];
	argv[0] = (double)v;
	return true;
}
bool double_release(int argc, BVariant* argv)
{

	return true;
}

bool double_assign_int(int argc, BVariant* argv)
{
	int i = argv[1];
	argv[0] = (double)i;
	return true;
}
bool double_assign_float(int argc, BVariant* argv)
{
	float f = argv[1];
	argv[0] = (double)f;
	return true;
}
bool double_assign_double(int argc, BVariant* argv)
{
	double d = argv[1];
	argv[0] = d;
	return true;
}
bool double_assign_bool(int argc, BVariant* argv)
{
	bool b = argv[1];
	argv[0] = b ? 1.0 : 0.0;
	return true;
}

bool double_plus_plus(int argc, BVariant* argv)
{
	double& v = argv[0];
	v++;
	return true;
}
bool double_minus_minus(int argc, BVariant* argv)
{
	double& v = argv[0];
	v--;
	return true;
}

bool double_plus_int(int argc, BVariant* argv)
{
	double v = argv[0];
	int a = argv[1];
	argv[0].setValue(v + a);
	return true;
}
bool double_plus_long(int argc, BVariant* argv)
{
	double v = argv[0];
	long long b = argv[1];
	argv[0].setValue(v + b);
	return true;
}
bool double_plus_float(int argc, BVariant* argv)
{
	double v = argv[0];
	float f = argv[1];
	argv[0].setValue(v + f);
	return true;
}
bool double_plus_double(int argc, BVariant* argv)
{
	double v = argv[0];
	double d = argv[1];
	argv[0].setValue(v + d);
	return true;
}

bool double_plus_assign_int(int argc, BVariant* argv)
{
	double& v = argv[0];
	double d = argv[1];
	v += d;
	return true;
}
bool double_plus_assign_long(int argc, BVariant* argv)
{
	double& v = argv[0];
	double d = argv[1];
	v += d;
	return true;
}
bool double_plus_assign_float(int argc, BVariant* argv)
{
	double& v = argv[0];
	double d = argv[1];
	v += d;
	return true;
}
bool double_plus_assign_double(int argc, BVariant* argv)
{
	double& v = argv[0];
	double d = argv[1];
	v += d;
	return true;
}

bool double_minus_int(int argc, BVariant* argv)
{
	double v = argv[0];
	double d = argv[1];
	argv[0].setValue(v - d);
	return true;
}
bool double_minus_long(int argc, BVariant* argv)
{
	double v = argv[0];
	double d = argv[1];
	argv[0].setValue(v - d);
	return true;
}
bool double_minus_float(int argc, BVariant* argv)
{
	double v = argv[0];
	double d = argv[1];
	argv[0].setValue(v - d);
	return true;
}
bool double_minus_double(int argc, BVariant* argv)
{
	double v = argv[0];
	double d = argv[1];
	argv[0].setValue(v - d);
	return true;
}

bool double_minus_assign_int(int argc, BVariant* argv)
{
	double& v = argv[0];
	double d = argv[1];
	v -= d;
	return true;
}
bool double_minus_assign_long(int argc, BVariant* argv)
{
	double& v = argv[0];
	double d = argv[1];
	v -= d;
	return true;
}
bool double_minus_assign_float(int argc, BVariant* argv)
{
	double& v = argv[0];
	double d = argv[1];
	v -= d;
	return true;
}
bool double_minus_assign_double(int argc, BVariant* argv)
{
	double& v = argv[0];
	double d = argv[1];
	v -= d;
	return true;
}

bool double_equal_bool(int argc, BVariant* argv)
{
	double v = argv[0];
	bool b = argv[1];
	argv[0].setValue((bool)v == b);
	return true;
}
bool double_equal_int(int argc, BVariant* argv)
{
	double v = argv[0];
	int i = argv[1];
	argv[0].setValue(v == i);
	return true;
}
bool double_equal_long(int argc, BVariant* argv)
{
	double v = argv[0];
	long l = argv[1];
	argv[0].setValue(v == l);
	return true;
}
bool double_equal_float(int argc, BVariant* argv)
{
	double v = argv[0];
	float f = argv[1];
	argv[0].setValue(v == f);
	return true;
}
bool double_equal_double(int argc, BVariant* argv)
{
	double v = argv[0];
	double d = argv[1];
	argv[0].setValue(v == d);
	return true;
}

bool double_unequal_bool(int argc, BVariant* argv)
{
	double v = argv[0];
	bool b = argv[1];
	argv[0].setValue((bool)v != b);
	return true;
}
bool double_unequal_int(int argc, BVariant* argv)
{
	double v = argv[0];
	int i = argv[1];
	argv[0].setValue(v == i);
	return true;
}
bool double_unequal_long(int argc, BVariant* argv)
{
	double v = argv[0];
	long l = argv[1];
	argv[0].setValue(v != l);
	return true;
}
bool double_unequal_float(int argc, BVariant* argv)
{
	double v = argv[0];
	float f = argv[1];
	argv[0].setValue(v != f);
	return true;
}
bool double_unequal_double(int argc, BVariant* argv)
{
	double v = argv[0];
	double d = argv[1];
	argv[0].setValue(v != d);
	return true;
}

bool double_greater_int(int argc, BVariant* argv)
{
	double v = argv[0];
	int i = argv[1];
	argv[0].setValue(v > i);
	return true;
}
bool double_greater_long(int argc, BVariant* argv)
{
	double v = argv[0];
	long long l = argv[1];
	argv[0].setValue(v > l);
	return true;
}
bool double_greater_float(int argc, BVariant* argv)
{
	double v = argv[0];
	float f = argv[1];
	argv[0].setValue(v > f);
	return true;
}
bool double_greater_double(int argc, BVariant* argv)
{
	double v = argv[0];
	double d = argv[1];
	argv[0].setValue(v > d);
	return true;
}

bool double_less_int(int argc, BVariant* argv)
{
	double v = argv[0];
	int i = argv[1];
	argv[0].setValue(v < i);
	return true;
}
bool double_less_long(int argc, BVariant* argv)
{
	double v = argv[0];
	long long l = argv[1];
	argv[0].setValue(v < l);
	return true;
}
bool double_less_float(int argc, BVariant* argv)
{
	double v = argv[0];
	float f = argv[1];
	argv[0].setValue(v < f);
	return true;
}
bool double_less_double(int argc, BVariant* argv)
{
	double v = argv[0];
	double d = argv[1];
	argv[0].setValue(v < d);
	return true;
}

bool double_greater_equal_int(int argc, BVariant* argv)
{
	double v = argv[0];
	int i = argv[1];
	argv[0].setValue(v >= i);
	return true;
}
bool double_greater_equal_long(int argc, BVariant* argv)
{
	double v = argv[0];
	long long l = argv[1];
	argv[0].setValue(v >= l);
	return true;
}
bool double_greater_equal_float(int argc, BVariant* argv)
{
	double v = argv[0];
	float f = argv[1];
	argv[0].setValue(v >= f);
	return true;
}
bool double_greater_equal_double(int argc, BVariant* argv)
{
	double v = argv[0];
	double d = argv[1];
	argv[0].setValue(v >= d);
	return true;
}

bool double_less_equal_int(int argc, BVariant* argv)
{
	double v = argv[0];
	int i = argv[1];
	argv[0].setValue(v <= i);
	return true;
}
bool double_less_equal_long(int argc, BVariant* argv)
{
	double v = argv[0];
	long long l = argv[1];
	argv[0].setValue(v <= l);
	return true;
}
bool double_less_equal_float(int argc, BVariant* argv)
{
	double v = argv[0];
	float f = argv[1];
	argv[0].setValue(v <= f);
	return true;
}
bool double_less_equal_double(int argc, BVariant* argv)
{
	double v = argv[0];
	double d = argv[1];
	argv[0].setValue(v <= d);
	return true;
}

BClass* BWE::CreateDoubleClass()
{
	BClass* cls = new BClass();

	cls->insertMethod("double()", double_create);
	cls->insertMethod("double(bool)", double_create_bool);
	cls->insertMethod("double(int)", double_create_int);
	cls->insertMethod("double(float)", double_create_float);
	cls->insertMethod("double(double)", double_create_double);

	cls->insertMethod("double =(bool)", double_assign_bool);
	cls->insertMethod("double =(int)", double_assign_int);
	cls->insertMethod("double =(float)", double_assign_float);
	cls->insertMethod("double =(double)", double_assign_double);

	cls->insertMethod("++()", double_plus_plus);
	cls->insertMethod("--()", double_minus_minus);

	cls->insertMethod("double +(int)", double_plus_int);
	cls->insertMethod("double +(long)", double_plus_long);
	cls->insertMethod("double +(float)", double_plus_float);
	cls->insertMethod("double +(double)", double_plus_double);

	cls->insertMethod("+=(int)", double_plus_assign_int);
	cls->insertMethod("+=(long)", double_plus_assign_long);
	cls->insertMethod("+=(float)", double_plus_assign_float);
	cls->insertMethod("+=(double)", double_plus_assign_double);

	cls->insertMethod("double -(int)", double_minus_int);
	cls->insertMethod("double -(long)", double_minus_long);
	cls->insertMethod("double -(float)", double_minus_float);
	cls->insertMethod("double -(double)", double_minus_double);

	cls->insertMethod("-=(int)", double_minus_assign_int);
	cls->insertMethod("-=(long)", double_minus_assign_long);
	cls->insertMethod("-=(float)", double_minus_assign_float);
	cls->insertMethod("-=(double)", double_minus_assign_double);

	cls->insertMethod("bool ==(bool)", double_equal_bool);
	cls->insertMethod("bool ==(int)", double_equal_int);
	cls->insertMethod("bool ==(long)", double_equal_long);
	cls->insertMethod("bool ==(float)", double_equal_float);
	cls->insertMethod("bool ==(double)", double_equal_double);

	cls->insertMethod("bool !=(bool)", double_unequal_bool);
	cls->insertMethod("bool !=(int)", double_unequal_int);
	cls->insertMethod("bool !=(long)", double_unequal_long);
	cls->insertMethod("bool !=(float)", double_unequal_float);
	cls->insertMethod("bool !=(double)", double_unequal_double);

	cls->insertMethod("bool >(int)", double_greater_int);
	cls->insertMethod("bool >(long)", double_greater_long);
	cls->insertMethod("bool >(float)", double_greater_float);
	cls->insertMethod("bool >(double)", double_greater_double);

	cls->insertMethod("bool <(int)", double_less_int);
	cls->insertMethod("bool <(long)", double_less_long);
	cls->insertMethod("bool <(float)", double_less_float);
	cls->insertMethod("bool <(double)", double_less_double);

	cls->insertMethod("bool >=(int)", double_greater_equal_int);
	cls->insertMethod("bool >=(long)", double_greater_equal_long);
	cls->insertMethod("bool >=(float)", double_greater_equal_float);
	cls->insertMethod("bool >=(double)", double_greater_equal_double);

	cls->insertMethod("bool <=(int)", double_less_equal_int);
	cls->insertMethod("bool <=(long)", double_less_equal_long);
	cls->insertMethod("bool <=(float)", double_less_equal_float);
	cls->insertMethod("bool <=(double)", double_less_equal_double);

	return cls;
}

//string functions.
bool string_create(int argc, BVariant* argv)
{
	argv[0] = new BString();
	return true;
}
bool string_create_int(int argc, BVariant* argv)
{
	int i = argv[1];
	argv[0] = new BString(i);
	return true;
}
bool string_create_uint(int argc, BVariant* argv)
{
	unsigned int ui = argv[1];
	argv[0] = new BString(ui);
	return true;
}
bool string_create_long(int argc, BVariant* argv)
{
	long long l = argv[1];
	argv[0] = new BString(l);
	return true;
}
bool string_create_ulong(int argc, BVariant* argv)
{
	unsigned long long ul = argv[1];
	argv[0] = new BString(ul);
	return true;
}
bool string_create_float(int argc, BVariant* argv)
{
	float f = argv[1];
	argv[0] = new BString(f);
	return true;
}
bool string_create_double(int argc, BVariant* argv)
{
	double d = argv[1];
	argv[0] = new BString(d);
	return true;
}
bool string_create_string(int argc, BVariant* argv)
{
	const BString& str = argv[1];
	argv[0] = new BString(str);
	return true;
}
bool string_release(int argc, BVariant* argv)
{

	return true;
}

bool string_assign_string(int argc, BVariant* argv)
{
	BString& str = argv[0];
	const BString& str1 = argv[1];
	str = str1;
	return true;
}
bool string_assign_int(int argc, BVariant* argv)
{
	BString& str = argv[0];
	int v = argv[1];
	str = v;
	return true;
}
bool string_assign_float(int argc, BVariant* argv)
{
	BString& str = argv[0];
	float v = argv[1];
	str = v;
	return true;
}
bool string_assign_double(int argc, BVariant* argv)
{
	BString& str = argv[0];
	double v = argv[1];
	str = v;
	return true;
}

bool string_plus_string(int argc, BVariant* argv)
{
	const BString& str = argv[0];
	const BString& str1 = argv[1];
	argv[0].setValue(str + str1);
	return true;
}
bool string_plus_int(int argc, BVariant* argv)
{
	const BString& str = argv[0];
	int i = argv[1];
	argv[0].setValue(str + i);
	return true;
}
bool string_plus_float(int argc, BVariant* argv)
{
	const BString& str = argv[0];
	float f = argv[1];
	argv[0].setValue(str + f);
	return true;
}
bool string_plus_double(int argc, BVariant* argv)
{
	const BString& str = argv[0];
	double d = argv[1];
	argv[0].setValue(str + d);
	return true;
}

bool string_empty(int argc, BVariant* argv)
{
	const BString& str = argv[0];
	argv[0].setValue(str.empty());
	return true;
}
bool string_clear(int argc, BVariant* argv)
{
	BString& self = argv[0];
	self.clear();
	return true;
}
bool string_reserve(int argc, BVariant* argv)
{
	int size = argv[1];
	BString& self = argv[0];
	self.reserve(size);
	return true;
}

bool string_size(int argc, BVariant* argv)
{
	const BString& str = argv[0];
	argv[0].setValue(str.size());
	return true;
}
bool string_capacity(int argc, BVariant* argv)
{
	const BString& str = argv[0];
	argv[0].setValue(str.capacity());
	return true;
}

bool string_is_number(int argc, BVariant* argv)
{
	const BString& str = argv[0];
	argv[0].setValue(str.isNumber());
	return true;
}
bool string_to_int(int argc, BVariant* argv)
{
	const BString& str = argv[0];
	argv[0].setValue(str.toInt());
	return true;
}
bool string_to_long(int argc, BVariant* argv)
{
	const BString& str = argv[0];
	argv[0].setValue(str.toInt());
	return true;
}
bool string_to_uint(int argc, BVariant* argv)
{
	const BString& str = argv[0];
	argv[0].setValue(str.toUInt());
	return true;
}
bool string_to_ulong(int argc, BVariant* argv)
{
	const BString& str = argv[0];
	argv[0].setValue(str.toULong());
	return true;
}
bool string_to_float(int argc, BVariant* argv)
{
	const BString& str = argv[0];
	argv[0].setValue(str.toFloat());
	return true;
}
bool string_to_double(int argc, BVariant* argv)
{
	const BString& str = argv[0];
	argv[0].setValue(str.toDouble());
	return true;
}

BClass* BWE::CreateStringClass()
{
	BClass* cls = new BClass();
	class_member(cls)->type = "string";

	cls->insertMethod("string()", string_create);
	cls->insertMethod("string(int)", string_create_int);
	cls->insertMethod("string(uint)", string_create_uint);
	cls->insertMethod("string(long)", string_create_long);
	cls->insertMethod("string(ulong)", string_create_ulong);
	cls->insertMethod("string(float)", string_create_float);
	cls->insertMethod("string(double)", string_create_double);
	cls->insertMethod("string(string)", string_create_string);
	cls->insertMethod("~string()", string_release);

	cls->insertMethod("string =(string)", string_assign_string);
	cls->insertMethod("string =(int)", string_assign_int);
	cls->insertMethod("string =(float)", string_assign_float);
	cls->insertMethod("string =(double)", string_assign_double);
	cls->insertMethod("string +(string)", string_plus_string);
	cls->insertMethod("string +(int)", string_plus_int);
	cls->insertMethod("string +(float)", string_plus_float);
	cls->insertMethod("string +(double)", string_plus_double);

	cls->insertMethod("int size()", string_size);
	cls->insertMethod("bool empty()", string_empty);
	cls->insertMethod("void clear()", string_clear);
	cls->insertMethod("bool reserve(int)", string_reserve);
	cls->insertMethod("int capacity()", string_capacity);

	cls->insertMethod("bool isNumber()", string_is_number);
	cls->insertMethod("int toInt()", string_to_int);
	cls->insertMethod("uint toUInt()", string_to_uint);
	cls->insertMethod("long toLong()", string_to_long);
	cls->insertMethod("ulong toULong()", string_to_ulong);
	cls->insertMethod("float toFloat()", string_to_float);
	cls->insertMethod("double toDouble()", string_to_double);

	return cls;
}

typedef BArray<BValue>	BValueArray;
bool Array_create(int argc, BVariant* argv)
{
	argv[0] = new BValueArray();
	return true;
}
bool Array_create_size(int argc, BVariant* argv)
{
	int size = argv[1];
	argv[0] = new BValueArray(size);
	return true;
}
bool Array_create_value_size(int argc, BVariant* argv)
{
	const BValue& value = argv[1];
	int size = argv[2];
	argv[0] = new BValueArray(value, size);
	return true;
}
bool Array_create_array(int argc, BVariant* argv)
{
	const BValueArray& other = argv[1];
	argv[0] = new BValueArray(other);
	return true;
}
bool Array_create_array_pos_size(int argc, BVariant* argv)
{
	const BValueArray& other = argv[1];
	int pos = argv[2];
	int size = argv[3];
	argv[0] = new BValueArray(other, pos, size);
	return true;
}
bool Array_release(int argc, BVariant* argv)
{
	return true;
}

bool Array_empty(int argc, BVariant* argv)
{
	const BValueArray& self = argv[0];
	bool res = self.empty();
	argv[0].setValue(res);
	return true;
}
bool Array_size(int argc, BVariant* argv)
{
	const BValueArray& self = argv[0];
	argv[0].setValue(self.size());
	return true;
}
bool Array_capacity(int argc, BVariant* argv)
{
	const BValueArray& self = argv[0];
	argv[0].setValue(self.capacity());
	return true;
}
bool Array_reset(int argc, BVariant* argv)
{
	BValueArray& self = argv[0];
	self.reset();
	return true;
}
bool Array_clear(int argc, BVariant* argv)
{
	BValueArray& self = argv[0];
	self.clear();
	return true;
}

bool Array_resize(int argc, BVariant* argv)
{
	BValueArray& self = argv[0];
	int size = argv[1];
	self.resize(size);
	return true;
}
bool Array_reserve(int argc, BVariant* argv)
{
	BValueArray& self = argv[0];
	int size = argv[1];
	self.reserve(size);
	return true;
}
bool Array_check(int argc, BVariant* argv)
{
	const BValueArray& self = argv[0];
	int index = argv[1];
	self.check(index);
	return true;
}

bool Array_set_pos_value(int argc, BVariant* argv)
{
	BValueArray& self = argv[0];
	int pos = argv[1];
	const BValue& value = argv[2];
	self.set(pos, value);
	return true;
}
bool Array_set_pos_array(int argc, BVariant* argv)//int pos, const BArray<T>& other)
{
	BValueArray& self = argv[0];
	int pos = argv[1];
	const BValueArray& other = argv[2];
	self.set(pos, other);
	return true;
}

bool Array_fill_value(int argc, BVariant* argv)
{
	BValueArray& self = argv[0];
	const BValue& value = argv[1];
	self.fill(value);
	return true;
}
bool Array_fill_value_pos_size(int argc, BVariant* argv)
{
	BValueArray& self = argv[0];
	const BValue& value = argv[1];
	int pos = argv[2];
	int size = argv[3];
	self.fill(value, pos, size);
	return true;
}

bool Array_find(int argc, BVariant* argv)
{
	const BValueArray& self = argv[0];
	const BValue& value = argv[0];
	int pos = argv[2];
	self.find(value, pos);
	return pos;
}
bool Array_rfind(int argc, BVariant* argv)// = -1) const
{
	const BValueArray& self = argv[0];
	const BValue& value = argv[1];
	int pos = argv[2];
	return pos;
}

bool Array_count(int argc, BVariant* argv)
{
	const BValueArray& self = argv[0];
	const BValue& value = argv[1];
	int size = self.count(value);
	argv->setValue(size);
	return true;
}
bool Array_contain(int argc, BVariant* argv)
{
	const BValueArray& self = argv[0];
	const BValue& value = argv[1];
	bool res = self.contain(value);
	argv->setValue(res);
	return true;
}
bool Array_replace(int argc, BVariant* argv)
{
	BValueArray& self = argv[0];
	const BValue& oldValue = argv[1];
	const BValue& newValue = argv[2];
	int size = self.replace(oldValue, newValue);
	argv->setValue(size);
	return true;
}

bool Array_move(int argc, BVariant* argv)
{
	BValueArray& self = argv[0];
	int index = argv[1];
	int dest = argv[2];
	bool res = self.move(index, dest);
	argv->setValue(res);
	return true;
}
bool Array_swap(int argc, BVariant* argv)
{
	BValueArray& self = argv[0];
	int index0 = argv[1];
	int index1 = argv[2];
	bool res = self.swap(index0, index1);
	argv->setValue(res);
	return true;
}

bool Array_reverse(int argc, BVariant* argv)
{
	BValueArray& self = argv[0];
	self.reverse();
	return true;
}

bool Array_raise(int argc, BVariant* argv)//)
{
	BValueArray& self = argv[0];
	const BValue& value = argv[1];
	self.raise(value);
	return true;
}
bool Array_lower(int argc, BVariant* argv)//UT& value)
{
	BValueArray& self = argv[0];
	const BValue& value = argv[1];
	self.lower(value);
	return true;
}

bool Array_first(int argc, BVariant* argv)
{
	const BValueArray& self = argv[0];
	const BValue& value = self.first();
	argv[0].setValue(value);
	return true;
}
bool Array_first_const(int argc, BVariant* argv)
{
	const BValueArray& self = argv[0];
	const BValue& value = self.first();
	argv[0].setValue(value);
	return true;
}

bool Array_last(int argc, BVariant* argv)
{
	const BValueArray& self = argv[0];
	const BValue& value = self.last();
	argv[0].setValue(value);
	return true;
}
bool Array_last_const(int argc, BVariant* argv)
{
	const BValueArray& self = argv[0];
	const BValue& value = self.last();
	argv[0].setValue(value);
	return true;
}

bool Array_middle(int argc, BVariant* argv)
{
	const BValueArray& self = argv[0];
	const BValue& value = self.middle();
	argv[0].setValue(value);
	return true;
}
bool Array_middle_const(int argc, BVariant* argv)
{
	const BValueArray& self = argv[0];
	const BValue& value = self.middle();
	argv[0].setValue(value);
	return true;
}

bool Array_at(int argc, BVariant* argv)
{
	const BValueArray& self = argv[0];
	int index = argv[1];
	const BValue& value = self.at(index);
	argv[0].setValue(value);
	return true;
}
bool Array_at_const(int argc, BVariant* argv)
{
	const BValueArray& self = argv[0];
	int index = argv[1];
	const BValue& value = self.at(index);
	argv[0].setValue(value);
	return true;
}

bool Array_def(int argc, BVariant* argv)
{
	const BValueArray& self = argv[0];
	const BValue& value = self.def();
	argv[0].setValue(value);
	return true;
}
bool Array_def_const(int argc, BVariant* argv)
{
	const BValueArray& self = argv[0];
	const BValue& value = self.def();
	argv[0].setValue(value);
	return true;
}

bool Array_append_value(int argc, BVariant* argv)
{
	BValueArray& self = argv[0];
	const BValue& value = self.append();
	argv[0].setValue(value);
	return true;
}
bool Array_append_value_size(int argc, BVariant* argv)
{
	BValueArray& self = argv[0];
	const BValue& value = argv[1];
	int size = argv[2];
	bool res = self.append(value, size);
	argv[0].setValue(res);
	return true;
}
bool Array_append_array_pos_size(int argc, BVariant* argv)
{
	BValueArray& self = argv[0];
	const BValueArray& other = argv[1];
	int pos = argv[2];
	int size = argv[3];
	bool res = self.append(other, pos, size);
	argv[0].setValue(res);
	return true;
}

bool Array_prepend_value(int argc, BVariant* argv)
{
	BValueArray& self = argv[0];
	const BValue& value = self.prepend();
	argv[0].setValue(value);
	return true;
}
bool Array_prepend_value_size(int argc, BVariant* argv)
{
	BValueArray& self = argv[0];
	const BValue& value = argv[1];
	int size = argv[2];
	bool res = self.prepend(value, size);
	argv[0].setValue(res);
	return true;
}
bool Array_prepend_array_pos_size(int argc, BVariant* argv)
{
	BValueArray& self = argv[0];
	const BValueArray& other = argv[1];
	int pos = argv[2];
	int size = argv[3];
	bool res = self.prepend(other, pos, size);
	argv[0].setValue(res);
	return true;
}

bool Array_insert_pos_value(int argc, BVariant* argv)
{
	BValueArray& self = argv[0];
	int pos = argv[1];
	const BValue& value = self.insert(pos);
	argv[0].setValue(value);
	return true;
}
bool Array_insert_pos_value_size(int argc, BVariant* argv)
{
	BValueArray& self = argv[0];
	int pos = argv[1];
	const BValue& value = argv[2];
	int size = argv[3];
	bool res = self.insert(pos, value, size);
	argv[0].setValue(res);
	return true;
}
bool Array_insert_pos_array_first_size(int argc, BVariant* argv)
{
	BValueArray& self = argv[0];
	int pos = argv[1];
	const BValueArray& other = argv[2];
	int first = argv[3];
	int size = argv[4];
	bool res = self.insert(pos, other, first, size);
	argv[0].setValue(res);
	return true;
}

bool Array_remove_pos_size(int argc, BVariant* argv)
{
	BValueArray& self = argv[0];
	int pos = argv[1];
	int size = argv[2];
	bool res = self.remove(pos, size);
	argv[0].setValue(res);
	return true;
}
bool Array_remove_value(int argc, BVariant* argv)
{
	BValueArray& self = argv[0];
	const BValue& value = argv[1];
	bool res = self.remove(value);
	argv[0].setValue(res);
	return true;
}
bool Array_remove_array(int argc, BVariant* argv)
{
	BValueArray& self = argv[0];
	const BValueArray& other = argv[1];
	bool res = self.remove(other);
	argv[0].setValue(res);
	return true;
}

bool Array_operator_brackets(int argc, BVariant* argv)
{
	const BValueArray& self = argv[0];
	int index = argv[1];
	const BValue& value = self(index);
	argv[0].setValue(value);
	return true;
}
bool Array_operator_square_brackets(int argc, BVariant* argv)
{
	const BValueArray& self = argv[0];
	int index = argv[1];
	const BValue& value = self[index];
	argv[0].setValue(value);
	return true;
}
bool Array_operator_equal_array(int argc, BVariant* argv)
{
	BValueArray& self = argv[0];
	const BValueArray& other = argv[1];
	self = other;
	return true;
}
bool Array_operator_equal_value(int argc, BVariant* argv)
{
	BValueArray& self = argv[0];
	const BValue& value = argv[1];
	self = value;
	return true;
}
bool Array_operator_plus_value(int argc, BVariant* argv)
{
	const BValueArray& self = argv[0];
	const BValue& value = argv[1];
	argv->setValue(BValueArray());
	BValueArray& res = argv[0];
	res = self + value;
	return true;
}
bool Array_operator_plus_array(int argc, BVariant* argv)
{
	const BValueArray& self = argv[0];
	const BValueArray& other = argv[1];
	argv->setValue(BValueArray());
	BValueArray& res = argv[0];
	res = self + other;
	return true;
}
bool Array_operator_plus_equal_value(int argc, BVariant* argv)
{
	BValueArray& self = argv[0];
	const BValue& value = argv[1];
	self += value;
	return true;
}
bool Array_operator_minus_equal_value(int argc, BVariant* argv)
{
	BValueArray& self = argv[0];
	const BValue& value = argv[1];
	self -= value;
	return true;
}
bool Array_operator_append_value(int argc, BVariant* argv)
{
	BValueArray& self = argv[0];
	const BValue& value = argv[1];
	self << value;
	return true;
}
bool Array_operator_append_array(int argc, BVariant* argv)
{
	BValueArray& self = argv[0];
	const BValueArray& other = argv[1];
	self << other;
	return true;
}
bool Array_operator_equal(int argc, BVariant* argv)
{
	const BValueArray& self = argv[0];
	const BValueArray& other = argv[1];
	bool res = self == other;
	argv->setValue(res);
	return true;
}
bool Array_operator_unequal(int argc, BVariant* argv)
{
	const BValueArray& self = argv[0];
	const BValueArray& other = argv[1];
	bool res = self == other;
	argv->setValue(res);
	return true;
}

BClass* BWE::CreateArrayTemplate()
{
	BClass* cls = new BClass();
	class_member(cls)->type = "Array";

	cls->insertMethod("Array()", Array_create);
	cls->insertMethod("Array(int)", Array_create_size);
	cls->insertMethod("Array(const T&, int)", Array_create_value_size);
	cls->insertMethod("Array(const Array<T>&)", Array_create_array);
	cls->insertMethod("Array(const Array<T>&, int, int)", Array_create_array_pos_size);
	cls->insertMethod("~Array()", Array_release);

	cls->insertMethod("bool empty() const", Array_empty);
	cls->insertMethod("int size() const", Array_size);
	cls->insertMethod("int capacity() const", Array_capacity);
	cls->insertMethod("void reset()", Array_reset);
	cls->insertMethod("void clear()", Array_clear);

	cls->insertMethod("bool resize(int)", Array_resize);
	cls->insertMethod("bool reserve(int)", Array_reserve);
	cls->insertMethod("bool check(int) const", Array_check);

	cls->insertMethod("bool set(int, const T&)", Array_set_pos_value);
	cls->insertMethod("bool set(int, const Array<T>&)", Array_set_pos_array);

	cls->insertMethod("bool fill(const T&)", Array_fill_value);
	cls->insertMethod("bool fill(const T&, int, int)", Array_fill_value_pos_size);

	cls->insertMethod("int find(const T&, int) const", Array_find);
	cls->insertMethod("int rfind(const T&, int) const", Array_rfind);

	cls->insertMethod("int count(const T&) const", Array_count);
	cls->insertMethod("int contain(const T&) const", Array_contain);
	cls->insertMethod("int replace(const T&, const T&)", Array_replace);

	cls->insertMethod("bool move(int, int)", Array_move);
	cls->insertMethod("bool swap(int, int)", Array_swap);

	cls->insertMethod("bool reverse()", Array_reverse);

	cls->insertMethod("bool raise(const T&)", Array_raise);
	cls->insertMethod("bool lower(const T&)", Array_lower);

	cls->insertMethod("T& first()", Array_first);
	cls->insertMethod("const T& first() const", Array_first_const);

	cls->insertMethod("T& last()", Array_last);
	cls->insertMethod("const T& last() const", Array_last_const);

	cls->insertMethod("T& middle()", Array_middle);
	cls->insertMethod("const T& middle() const", Array_middle_const);

	cls->insertMethod("T& at()", Array_at);
	cls->insertMethod("const T& at() const", Array_at_const);

	cls->insertMethod("T& def()", Array_def_const);
	cls->insertMethod("const T& def() const", Array_def_const);

	cls->insertMethod("T& append()", Array_append_value);
	cls->insertMethod("bool append(const T&, int)", Array_append_value_size);
	cls->insertMethod("bool append(const Array<T>&, int, int)", Array_append_array_pos_size);

	cls->insertMethod("bool prepend()", Array_prepend_value);
	cls->insertMethod("bool prepend(const T&, int)", Array_prepend_value_size);
	cls->insertMethod("bool prepend(const Array<T>&, int, int)", Array_prepend_array_pos_size);

	cls->insertMethod("T& insert(int)", Array_insert_pos_value);
	cls->insertMethod("bool insert(int, const T&, int)", Array_insert_pos_value_size);
	cls->insertMethod("bool insert(int, const Array<T>&, int, int)", Array_insert_pos_array_first_size);

	cls->insertMethod("bool remove(int, int)", Array_remove_pos_size);
	cls->insertMethod("bool remove(const T&)", Array_remove_value);
	cls->insertMethod("bool remove(const Array<T>&)", Array_remove_array);

	cls->insertMethod("T& ()(int)", Array_operator_brackets);
	cls->insertMethod("T& [](int)", Array_operator_square_brackets);
	cls->insertMethod("const Array<T>& =(const Array<T>&)", Array_operator_equal_array);
	cls->insertMethod("const Array<T>& =(const T&)", Array_operator_equal_value);
	cls->insertMethod("Array<T> +(const T&)", Array_operator_plus_value);
	cls->insertMethod("Array<T> +(const Array<T>&)", Array_operator_plus_array);
	cls->insertMethod("void +=(const T&)", Array_operator_plus_equal_value);
	cls->insertMethod("void -=(const T&)", Array_operator_minus_equal_value);
	cls->insertMethod("Array<T>& <<(const T&)", Array_operator_append_value);
	cls->insertMethod("Array<T>& <<(const Array<T>&)", Array_operator_append_array);
	cls->insertMethod("bool ==(const Array<T>&) const", Array_operator_equal);
	cls->insertMethod("bool !=(const Array<T>&) const", Array_operator_unequal);

	return cls;
}
BClass* BWE::CreateListTemplate()
{
	return 0;
}
BClass* BWE::CreateSetTemplate()
{
	return 0;
}
BClass* BWE::CreateMapTemplate()
{
	return 0;
}
